﻿Imports Microsoft.VisualBasic

Public Class Authenticationservice


    Public Function Authenticate(ByVal username As String, ByVal password As String) As Integer
        Dim ad As New AuthenticationDAO()
        Dim id As Integer = ad.CheckUsernameAndPassword(username, password)

        If id > 0 Then
            FormsAuthentication.Initialize()
            FormsAuthentication.SetAuthCookie(username, False)

        End If

        Return id


    End Function

    Public Sub UnAuthenticate()
        FormsAuthentication.SignOut()
    End Sub


End Class
